import request from '@/utils/request'

// 查询学生注册列表
export function listRegistration(query) {
  return request({
    url: '/student/registration/list',
    method: 'get',
    params: query
  })
}

// 查询学生注册详细
export function getRegistration(id) {
  return request({
    url: '/student/registration/' + id,
    method: 'get'
  })
}

// 新增学生注册
export function addRegistration(data) {
  return request({
    url: '/student/registration',
    method: 'post',
    data: data
  })
}

// 修改学生注册
export function updateRegistration(data) {
  return request({
    url: '/student/registration',
    method: 'put',
    data: data
  })
}

// 删除学生注册
export function delRegistration(id) {
  return request({
    url: '/student/registration/' + id,
    method: 'delete'
  })
}
/**
 * 开始导入学生注册信息
 * 从学生基本信息中导入当前学期需要注册的学生
 */
export function startImport() {
  return request({
    url: '/student/registration/start',
    method: 'post'
  })
}

/**
 * 查询导入进度
 * @param {string} batchNo - 导入批次号
 */
export function getImportProgress(batchNo) {
  return request({
    url: `/student/registration/progress/${batchNo}`,
    method: 'get'
  })
}

// 查询学生个人数据信息
export function searchStudentInfo() {
  return request({
    url: '/student/registration/search',
    method: 'get'
  })
}

// 检查IP是否在允许注册的范围内
export function checkRegistrationIP() {
  return request({
    url: '/student/registration/checkIP',
    method: 'post'
  })
}

// 获取当前登录用户的浏览器信息（IP、浏览器类型、操作系统）
export function getBrowserInfo() {
  return request({
    url: '/student/registration/browserInfo',
    method: 'get'
  })
}


// 新增：检查当前是否在注册时间段内
export function checkRegistryTime() {
  return request({
    url: '/student/registration/checkTime',
    method: 'get'
  })
}

// 以下是注册时间段管理相关接口（管理员使用）
// 查询注册时间段配置列表
export function listRegistryTime(query) {
  return request({
    url: '/student/registryTime/list',
    method: 'get',
    params: query
  })
}

// 查询注册时间段配置详细
export function getRegistryTime(id) {
  return request({
    url: '/student/registryTime/' + id,
    method: 'get'
  })
}

// 获取当前生效的注册时间段
export function getCurrentRegistryTime() {
  return request({
    url: '/student/registryTime/current',
    method: 'get'
  })
}

// 新增注册时间段配置
export function addRegistryTime(data) {
  return request({
    url: '/student/registryTime',
    method: 'post',
    data: data
  })
}

// 修改注册时间段配置
export function updateRegistryTime(data) {
  return request({
    url: '/student/registryTime',
    method: 'put',
    data: data
  })
}

// 删除注册时间段配置
export function delRegistryTime(id) {
  return request({
    url: '/student/registryTime/' + id,
    method: 'delete'
  })
}

// 导出注册时间段配置
export function exportRegistryTime(query) {
  return request({
    url: '/student/registryTime/export',
    method: 'post',
    params: query,
    responseType: 'blob'
  })
}
